package com.fer.tankr.controllers;

import org.andengine.engine.camera.Camera;
import org.andengine.entity.text.Text;

import com.fer.andenginemvc.api.Controller;
import com.fer.tankr.MainActivity;
import com.fer.tankr.scenes.HighScoreScene;

public class HighScoreControllers extends Controller<MainActivity> {

	public HighScoreControllers(MainActivity baseGame,
			Camera camera) {
		super(new HighScoreScene(baseGame.assetManager.hudFont, baseGame.assetManager.mGrassBackground, baseGame.getVertexBufferObjectManager(), camera), baseGame, camera);
		camera.setChaseEntity(scene);
	}

	@Override
	public void onShow() {
		camera.setChaseEntity(scene);
		
		int score1 = 12341;
		int score2 = 20040;
		int score3 = 25928;
		setScore(score1, 1);
		setScore(score2, 2);
		setScore(score3, 3);
	}
	
	void setScore(int score, int level)
	{
		Text hs1 = getScene().highScore1;
		Text hs2 = getScene().highScore2;
		Text hs3 = getScene().highScore3;
		
		switch (level) {
		case 1:
			hs1.setText("1. "+score);
			hs1.setX(camera.getWidth()/2 - hs1.getWidth()/2);
			break;
		case 2:
			hs2.setText("2. "+score);
			hs2.setX(camera.getWidth()/2 - hs2.getWidth()/2);
			break;
		case 3:
			hs3.setText("3. "+score);
			hs3.setX(camera.getWidth()/2 - hs3.getWidth()/2);
			break;
		
		}
	}

	public HighScoreScene getScene()
	{
		return (HighScoreScene) scene;
	}
}
